<?php

namespace app\admin\controller\business;

use app\common\controller\Backend;
class Receive extends Backend
{
    protected $relationSearch = true;
    public function _initialize()
    {
        parent::_initialize();
        $this->model = model('Business.Receive');
    }
    public function index(){
        $busid = $this->request->param('busid', 0, 'trim');
        if ($this->request->isAjax()) {
            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
            $total = $this->model
                ->with(['admin','business'])
                ->where($where)
                ->where('busid', $busid)
                ->order($sort, $order)
                ->count();
            $list = $this->model
                ->with(['admin','business'])
                ->where($where)
                ->where('busid', $busid)
                ->order($sort, $order)
                ->limit($offset, $limit)
                ->select();
            $result = array("total" => $total, "rows" => $list);

            return json($result);
        }
        return $this->view->fetch();
    }
}